package at.jku.ssw.fortress.ui;

public class Shorthand implements Comparable<Shorthand> {

	public final String unicode;
	public final String name;

	public Shorthand(String unicode, String name) {
		this.unicode = unicode;
		this.name = name;
	}
	
	public char unicode() {
		return (char) Integer.parseInt(unicode, 16);
	}
	
	public String unicodeString() {
		return Character.toString(unicode());
	}

	public int compareTo(Shorthand o) {
		return name.compareTo(o.name);
	}
	
	@Override
	public int hashCode() {
		return name.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Shorthand other = (Shorthand) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	

}
